#ifndef _statemanager_h_
#define _statemanager_h_
 
#include <vector>
#include <map>
 
typedef enum {
    STARTUP,
    GUI,
    LOADING,
    CANCEL_LOADING,
    GAME,
	GAME_PAUSED,
	SHUTDOWN,
    RESET,
    LEVELCHANGE
} StateManagerState;

/**
 * @brief The StateManager class
 *
 * manages the state of the game
 */
class StateManager {

public:
    /**
     * @brief Constructor of StateManager
     */
    StateManager();
    virtual ~StateManager();
 
public:
    /**
     * @brief requestStateChange
     * @param state: current state
     * @return bool
     *
     * returns true if state is STARTUP and false otherwise
     */
    bool requestStateChange(StateManagerState state);

    /**
     * @brief lockState
     * @return bool
     *
     * returns false if state is already locked, true if is changed to locked
     */
    bool lockState();

    /**
     * @brief unlockState
     * @return bool
     *
     * returns false if state is already unlocked, true if is changed to unlocked
     */
    bool unlockState();

    /**
     * @brief getCurrentState
     * @return m_state: member state manager state
     */
    StateManagerState getCurrentState();
 
    /**
     * @brief setFrameTime
     * @param ms: time in milli seconds
     */
    void setFrameTime(float ms);

    /**
     * @brief getFrameTime
     * @return m_frame_time
     */
    inline float getFrameTime() { return m_frame_time; }
 
protected:
    /**
     * @brief m_state
     * current state
     */
    StateManagerState m_state;

    /**
     * @brief m_locked
     * state regading locked of unlocked
     */
    bool m_locked;

    /**
     * @brief m_frame_time
     * frame time in ms
     */
    float m_frame_time;
};

#endif
